home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 1 / Cream of the Crop 1.iso / PROGRAM / VS_804.ARJ / MAINTSRC.EXE / _NTXTHEM.PRG < prev    next >
Text File  |  1991-06-20  |  3KB  |  131 lines

  1. * Filename......: _NtxThem.Prg
  2. *
  3. * Author........: Vernon E. Six, Jr.
  4. *
  5. * Last Update...: Tue  06-18-1991  09:56:39
  6. *
  7. * Notice........: Copyright (c) 1991 by Vernon E. Six, Jr.
  8. *                 All Rights Reserved World Wide
  9.  
  10. FUNCTION NTX_THEM
  11. *****
  12. * Re-Index the databases
  13. *****
  14. PRIVATE ac_DbfList[100]
  15. PRIVATE ac_Msg[3]
  16. PRIVATE n_Cntr
  17. PRIVATE n_Dbfs
  18.  
  19.    GRABSCRN()
  20.  
  21.       BEGIN SEQUENCE
  22.  
  23.          PALETTE(1)
  24.          NewScrn()
  25.  
  26.          PALETTE(3)
  27.          ac_msg[1] = "       Indexing databases.  Please wait.       "
  28.          ac_msg[2] = ""
  29.          ac_msg[3] = "D O   N O T   T U R N   C O M P U T E R   O F F"
  30.          DISPMSG(ac_msg,3,"","",3)
  31.          SET CURSOR OFF
  32.          PALETTE(2)
  33.  
  34.  
  35.          *****
  36.          * Remove all the index files
  37.          *****
  38.          SELECT A
  39.          USE
  40.  
  41.          IF .NOT. OVERLAY("DEL *.NTX",80)
  42.             GRABSCRN()
  43.                PALETTE(3)
  44.                ac_Msg[1] = "Can't delete old index files now"
  45.                ac_Msg[2] = ""
  46.                ac_Msg[3] = "     Please try again later.    "
  47.                DISPMSG(ac_Msg,3,"","")
  48.                INKEY(10)
  49.             PUTSCRN()
  50.             BREAK
  51.          ENDIF
  52.          
  53.  
  54.          SELECT A
  55.          IF .NOT. V_USE("DBF_HDR",.F.)
  56.             GRABSCRN()
  57.                PALETTE(3)
  58.                ac_Msg[1] = "Can't index databases now"
  59.                ac_Msg[2] = ""
  60.                ac_Msg[3] = " Please try again later. "
  61.                DISPMSG(ac_Msg,3,"","")
  62.                INKEY(10)
  63.             PUTSCRN()
  64.             BREAK
  65.          ENDIF
  66.  
  67.          *****
  68.          * Start by re-indexing the header file
  69.          *****
  70.          IF .NOT. SHOW_NTX("DBF_HDR","DBF_NAME","C")
  71.             GRABSCRN()
  72.                PALETTE(3)
  73.                ac_Msg[1] = "Can't index databases now"
  74.                ac_Msg[2] = ""
  75.                ac_Msg[3] = " Please try again later. "
  76.                DISPMSG(ac_Msg,3,"","")
  77.                INKEY(10)
  78.             PUTSCRN()
  79.             BREAK
  80.          ENDIF
  81.  
  82.  
  83.          *****
  84.          * Get a list of all the DBFs
  85.          *****
  86.          SELECT DBF_HDR
  87.          GO TOP
  88.  
  89.          n_Dbfs = 0
  90.          n_Cntr = 0
  91.  
  92.          DO WHILE .NOT. EOF()   && DBF_HDR
  93.             n_Dbfs = n_Dbfs + 1
  94.             ac_DbfList[n_Dbfs] = ALLTRIM(DBF_HDR->DBF_NAME)
  95.             SKIP
  96.          ENDDO
  97.  
  98.          USE
  99.          ASORT(ac_DbfList)
  100.  
  101.  
  102.          *****
  103.          * Here we go...
  104.          *****
  105.          FOR n_Cntr = 1 TO n_Dbfs
  106.  
  107.             *****
  108.             * OPEN_DBF() will create the NTX files
  109.             *****
  110.             IF .NOT. OPEN_DBF(ac_DbfList[n_Cntr],.F.)
  111.                GRABSCRN()
  112.                   PALETTE(3)
  113.                   ac_Msg[1] = "               Unable to index "+ac_DbfList[n_Cntr]+".DBF               "
  114.                   DISPMSG(ac_Msg,1,""," Press any key to continue ")
  115.                   INKEY(5)
  116.                PUTSCRN()
  117.             ENDIF
  118.  
  119.          NEXT n_Cntr
  120.  
  121.       END SEQUENCE
  122.  
  123.       USE
  124.       INITHELP()
  125.  
  126.    PUTSCRN()
  127.  
  128. RETURN(.T.)
  129. *** EOF: NTX_THEM() *********************************************************
  130.                      
  131.